<!-- Export Database -->
<div class="box box-left">
	<div class="title"><h5>Export Database</h5></div>
	<h4>Export databse to file</h4>
	<div id="box-left-forms">
		<div class="form">
			<div class="fields">
				<div class="field">
					<div class="label">
						<label for="input"><?php echo $this->__("Download Database file formate with SCHEMA and DATA"); ?></label>
					</div>						
				</div>					
				<div class="buttons">
					<form method="post" action="<?php echo $this->baseurl("/developer/imexport");?>">
						<input type="submit" class="app_button" value="Export" name="data[ImExport][export]" />
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="box box-right">
	<div class="title"><h5>Import Database</h5></div>
	<h4>Select database fle</h4>
	<div id="box-left-forms">
		<div class="form">
			<form enctype="multipart/form-data" action="<?php echo $this->baseurl("/developer/imexport");?>" method="POST">
			<div class="fields">
				<div class="field field-first">
					<div class="input">
						<input type="file" value="" name="data[ImExport][filename]" />
					</div>
				</div>					
				<div class="buttons">
					<input type="submit" class="app_button" value="Import" name="data[ImExport][import]" />
				</div>
			</div>
			</form>
		</div>
	</div>
</div>
<div style="clear:both"></div>
<!-- Export Database -->
<div class="box box-left box-padding">
	<div class="title"><h5>Backup/Restore Databse</h5></div>
	<h4>Create Backup</h4>
	<div id="box-left-forms">
		<div class="form">
			<form enctype="multipart/form-data" action="<?php echo $this->baseUrl("/developer/imexport");?>" method="POST">
			<div class="fields">
				<div class="field field-first">
					<div class="input">
						<input type="text" size="30" value="<?php echo App::Helper('Date')->getDate('Y-m-d_H-i-s'); ?>" name="data[ImExport][filename]">
					</div>
				</div>					
				<div class="buttons">
					<input type="submit" class="app_button" value="Create Backup" name="data[ImExport][backup]">
				</div>
			</div>
			</form>
		</div>
	</div>
	
	<h4>Restore Database</h4>
	<div id="box-left-forms">
		<div class="form">
			<form method="post" action="<?php echo $this->baseurl("/developer/imexport");?>" enctype="multipart/form-data">
			<div class="fields">
					<?php if( isset($database_files['file'])):?>
					<div class="field field-first">
						<!--div class="label">
							<label for="input"><?php echo $this->__("Select a file"); ?></label>
						</div -->
						<div class="input">
						<select name="data[ImExport][file_name]">
							<option value=""><?php echo $this->__("Select a version to rollback");?></option>
							<?php foreach ( $database_files['file'] as $key => $val ):?>
								<option  value="<?php echo $val['name'];?>"><?php echo $val['name'];?></option>
							<?php endforeach;?>
						</select>
					</div>
					</div>						
					<?php endif;?>
				<div class="buttons">
					<input type="submit" class="app_button" value="Restore" name="data[ImExport][restore]">
				</div>
			</div>
			</form>
		</div>
	</div>
</div>
<div class="box box-right box-padding">
	<div class="title"><h5>Restore Databse</h5></div>
	<h4>Database List</h4>
	<div id="box-right-forms">
		<div class="form">
			<div class="fields">
				<div class="field field-last field-last">					
				<?php if( isset($database_files_paging['data'])): ?>
					<?php
						$Grid = App::Module('DataGrid')->setHeader(array('Name', 'Download', 'Delete'))->setFooter($database_files_paging['paging_str']);
						foreach ($database_files_paging['data'] as $val ):
						$Grid->addRow($val['name'],
									  App::Helper('Html')->linkTag($this->baseurl("/common/download/" . base64_encode(DATA . DS . "database/{$val['name']}")),'Download'),
									  App::Helper('Html')->linkTag($this->baseurl("/developer/imexport/delete/" .base64_encode($val['name'])),'Delete',array('class'=>'confirm-link')));
						endforeach;				
					$Grid->Render();?>
				<?php endif;?>
				</div>
			</div>
		</div>
	</div>
</div>